<?php
namespace Admin\Controller;
use Admin\Controller\AdminBaseController;
use Common\Model\ConfigModel;
class ConfigController extends AdminBaseController{
	public function configlog()
	{
	    $config=ConfigModel::newSelf()->getInfo();
	    $this->assign('config',$config);
	    $this->display();
	} 
	public function updateConfig()
	{
	    $input=I('post.');    
	    $model=ConfigModel::newSelf();
	    if($_FILES['QRCODE']['size']>0){
	    	$rs=$this->uploadOne('QRCODE');
	    	if($rs['status']){
	    		$input['QRCODE']=$rs['info'];
	    	}else{
      			$this->returnResult($rs['info']);
	    	}
	    }
        foreach ($input as $k=>$v)
        {
        	if(!empty($v)){
               $model->where(['key'=>$k])->setField('value',$v);
        	}
        }
        $this->returnResult('修改成功',true);
	}
}
